<?php
/**
 * Created by PhpStorm.
 * User: liuwei
 * Date: 2018/2/23
 * Time: 上午10:02
 */


function main_default()
{
    main_page();
}

function main_page()
{
    _output_template(0, 'main');
}

function _zhengxie_outputMain()
{
    $avaurl = "images/main/22.png";
    $str = "";



    //已发起
    $data = array();
    $sql = "select count(*) as num from proposal where userid=".$_SESSION['USERID'];
    $result = $GLOBALS['DB']->query($sql);
    while($res=$result->fetch()) {
        $data = $res;
    }
    $yifaqinum=$data['num'];

    //未立案
    $sql = "select count(*) as num from proposal where userid=".$_SESSION['USERID']." and state=2";
    $result = $GLOBALS['DB']->query($sql);
    while($res=$result->fetch()) {
        $data = $res;
    }
    $weiliannum = $data['num'];


    //已完结
    $sql = "select count(*) as num from proposal where userid=".$_SESSION['USERID']." and state=6";
    $result = $GLOBALS['DB']->query($sql);
    while($res=$result->fetch()) {
        $data = $res;
    }
    $wanchengnum = $data['num'];

    //全部
    $all = getStatenumall();

    $daishencha=getStatenumDaiShenCha();
    $daishenchanum=$daishencha['num'];

    $daijiaoban=getStatenumDaijiaoban();
    $daijiaobannum=$daijiaoban['num'];

    $banlizhong=getStatenumBanlizhong();
    $banlizhongnum=$banlizhong['num'];

    $bili = getStatenumOk()['num']/$all['num'];
    $wanchengbili = $bili*100;
    //内容
//    $str=$str."
//
//            </div>
////            </div>
//            <div class='main_bottom_right'>";
    $str = $str . "
            <div class='main_bottom_right_top'>
            
            <div class='main_bottom_right_top_left'>
            
            <div class='main_bottom_right_top_left_avat' style='background-image: url(" . $avaurl . ")'> </div>
            <div class='main_bottom_right_top_left_info'>
              <div class='main_bottom_right_top_left_title'>早安,".$GLOBALS['USERINFO']['realname'].",祝你开心每一天!</div>
              <div class='main_bottom_right_top_left_info_bottom'>
              <div class='main_bottom_right_top_left_info_bottom_bule1'></div>
              <div class='main_bottom_right_top_left_info_bottom_year'>".$GLOBALS['USERINFO']['session']." 届委员</div>
               <div class='main_bottom_right_top_left_info_bottom_bule2'></div>
                <div class='main_bottom_right_top_left_info_bottom_area'>".$GLOBALS['USERINFO']['street']."</div>
                 <div class='main_bottom_right_top_left_info_bottom_gray'></div>
                 <div class='main_bottom_right_top_left_info_bottom_function'>".$GLOBALS['USERINFO']['work']."</div>
            </div>
            </div>
            
            <div class='main_bottom_right_top_left_gang'></div>
            </div>
            
            
            <div class='main_bottom_right_top_right'>
            
            <div class='main_bottom_right_top_right_wai1'>
            <div class='main_bottom_right_bottom_right1'>
            <div class='main_bottom_right_bottom_img1'></div> 
            <div  class='main_bottom_right_bottom_text1'>$yifaqinum
           
            </div>
            <div class='main_bottom_right_bottom_jian1'> (件)</div>
            <div  class='main_bottom_right_bottom_state1'>已发起</div>
            </div>
            </div>
            
             <div class='main_bottom_right_top_right_wai2'>
            <div class='main_bottom_right_bottom_right2'>
            <div class='main_bottom_right_bottom_img2'></div> 
           <div  class='main_bottom_right_bottom_text2'>
           $weiliannum
            </div>
             <div class='main_bottom_right_bottom_jian2'> (件)</div>
            <div  class='main_bottom_right_bottom_state1'>未立案</div>
            </div>
            </div>
              <div class='main_bottom_right_top_right_wai2'>
             <div class='main_bottom_right_bottom_right3'>
             <div class='main_bottom_right_bottom_img3'></div> 
           <div  class='main_bottom_right_bottom_text3'>$wanchengnum
           
            </div>
             <div class='main_bottom_right_bottom_jian3'> (件)</div>
            <div  class='main_bottom_right_bottom_state1'>已完结</div>
            </div>
            </div>
            </div>
               
            </div>
            ";


    $str = $str . "     
            <div class='main_bottom_right_bottom' style='height: 800px'>
                <div class='main_bottom_right_bottom_top' style='height: 200px;margin-top: 18px'>
                     <div class='main_box_father'>
                         <div class='main_bottom_right_bottom_left_text1'>本年度在办提案</div>
                         
                         <div class='main_box_the_father'>
                               <div class='main_box_daishencha'>
                                    <div class='main_box_kuai1'>
                                          <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 3px;'>
                                              <div class='main_inbox_daishencha'>
                                              待审查
                                              </div>
                                          </div>
                                          <div style='width: 0px;height: 0px;'></div>
                                          <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 5px;'>
                                          <div class='main_box_dazi'>$daishenchanum/</div>
                                          <div class='main_box_xiaozi'>".$all['num']."</div>
                                          <div style='clear: both'></div>
                                          </div>
                                    </div>
                               </div>
                         </div>
                         
                         <div class='main_box_the_father'>
                             <div class='main_box_daijiaoban'>
                                   <div class='main_box_kuai1'>
                                       <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 3px;'>
                                          <div class='main_inbox_daijiaoban'>
                                          待交办
                                          </div>
                                       </div>
                                       <div style='width: 0px;height: 0px;'></div>
                                       <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 5px;'>
                                           <div class='main_box_dazi'>$daijiaobannum/</div>
                                           <div class='main_box_xiaozi'>".$all['num']."</div>
                                           <div style='clear: both'></div>
                                       </div>
                                   </div>
                             </div>
                         </div>
                         
                         <div class='main_box_the_father'>
                             <div class='main_box_banlizhong'>
                                <div class='main_box_kuai1'>
                                     <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 3px;'>
                                          <div class='main_inbox_banlizhong'>
                                          办理中
                                          </div>
                                      </div>
                                      <div style='width: 0px;height: 0px;'></div>
                                      <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 5px;'>
                                          <div class='main_box_dazi'>$banlizhongnum/</div>
                                          <div class='main_box_xiaozi'>".$all['num']."</div>
                                          <div style='clear: both'></div>
                                      </div>
                                </div>
                             </div>
                         </div>
                         
                         <div class='main_box_the_father'>
                             <div class='main_banwanjie'>
                                 <div class='main_box_kuai1'>
                                      <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 3px;'>
                                          <div class='main_inbox_banwanjie'>
                                          办完结
                                          </div>
                                      </div>
                                      <div style='width: 0px;height: 0px;'></div>
                                      <div  style='position: relative;left: 50%;transform: translateX(-50%);float: left;margin-top: 5px;'>
                                          <div class='main_box_dazi'>".getStatenumOk()['num']."/</div>
                                          <div class='main_box_xiaozi'>".$all['num']."</div>
                                          <div style='clear: both'></div>
                                      </div>
                                 </div>
                             </div>
                         </div>
                         
                     </div>
                        
                     <div style='width: 230px;height: 210px;float: left;'>
                         <span style='font-size: 13px;float: left;height: 0px;margin-left: 10px;color: #999'>完成度</span>
                         
                         <div class='main_box_cainabili' >
                            <span style='color: #4e99ff;'></span>
                            <div class='circleChart' id='1' data-value=$wanchengbili style='color:#4e99ff;font-size: 30px;margin: auto'></div>
                         </div>
                     </div>
                     <div style='clear: both'></div>
                </div>
          
                <div class='main_bottom_right_bottom_bottom' style='width: 100%; height: 30px' >
                    <div style='width: 76%; margin-top: 10px;padding-left: 20px;float: left;'>
                        <div class='main_box_bottom_the_father'>
                            <div style='color:#4e99ff;font-size: 16px;margin-top: 4px'>消息通知(5)</div>
                        </div>
                        
                        <div class='main_box_bottom_the_father' style='height: 1px'></div>
                        
                        <div class='main_box_bottom_the_father' style='height: 1px'></div>
                        
                        <div class='main_box_bottom_the_father'>
                            <div style='width: 180px;height: 50px'>
                                <a href='?action=xinxi' style=' text-decoration: none;text-align: right'>
                                    <div style='color:#4e99ff;font-size: 14px;margin-top: 4px'>查看更多>></div>
                                </a>
                            </div>
                        </div>
                        
                        <div style='clear:both;'></div>
                    </div>
                    
                    <div style='width: 230px;float: left;color:#4e99ff;font-size: 16px;margin-top: 10px;line-height: 57px;height: 50px'>
                        统计
                    </div>
                    <div style='clear:both;'></div>
                </div>
                
                <div style='width: 72%; margin-left: 20px;float: left;margin-top: 10px;border:1px solid #eeeeee;border-radius: 5px;'>";

    $taskinfo = array();
    $sql = "select a.*,b.realname from task as a left join user as b on a.userid=b.id  where a.userid in (".$_SESSION['USERID'].") or a.groupid in (select role from user where id in (".$_SESSION['USERID'].")) or a.taskType=1 order by tasktime desc limit 5";
    $result = $GLOBALS['DB']->query($sql);
    while($res=$result->fetch()) {
        $taskinfo[] = $res;
    }

    foreach ($taskinfo as $item) {

        if ($item === end($taskinfo)) {
            $str .= " <div class='main_xiaoxi' style='width: 100%;height: 93px;'>";
        } else {
            $str .= " <div class='main_xiaoxi' style='width: 100%;height: 93px;border-bottom: 1px solid #eeeeee'>";
        }

        $name = $item["realname"];
        $title = $item["title"];
        $time = explode(" ",$item["tasktime"])[0];
        $num = $item["lookNum"];
        $state = $item['isLook'];
        if ($item["taskType"] == "1") {
            //公告
            $str .= "<div class='main_xiaoxi_img' style=' background-image: url(/images/message/gonggao.png);'></div>
                    <div class='main_xiaoxi_name'style='width: 15%;height:93px;line-height: 93px;float: left;color: #333;font-size: 16px'>【公告】</div>
                     <div class='main_xiaoxi_info' >".$title."</div>
                    ";

            $checkids = explode(",",$item['checkid']);
            $in = in_array($_SESSION['USERID'],$checkids);
            error_log('当前查看id->>'.$item['checkid'].'|||'.'当前用户id->>>'.$_SESSION['USERID']);
            if (!$in) {
                $str .= "  <div class='main_xiaoxi_state' >
                               <div class='main_xiaoxi_state_dian'></div>
                               <div class='main_xiaoxi_state_boolean'>未读</div>
                           </div>";
            } else {
                $str .= "  <div class='main_xiaoxi_state' >
                               <div class='main_xiaoxi_state_dian'></div>
                               <div class='main_xiaoxi_state_boolean'>已查看".$num."次</div>
                           </div>";
            }


            $str .= "  <div class='main_xiaoxi_time' >$time</div>
                            <a href='?action=main&announcementID=".$item['id']."' class='main_xiaoxi_a' id='main_01' ><div class='main_xiaoxi_chakan' id='main_01'>查看</div></a></div>";
        }
        else if ($item["taskType"] == "2") {
            //任务
            $str .= "<div class='main_xiaoxi_img' style=' background-image: url(/images/message/renwu.png);'></div>
                    <div class='main_xiaoxi_name'style='width: 15%;height:93px;line-height: 93px;float: left;color: #333;font-size: 16px'>【任务】</div>
                    <div class='main_xiaoxi_info' >".$item['taskcontent']."</div>
                    ";
            if ($state == 2) {
                $str .= "  <div class='main_xiaoxi_state' >
                           <div class='main_xiaoxi_state_dian'></div>
                           <div class='main_xiaoxi_state_boolean'>未读</div>
                            </div>";
            } else {
                $str .= "  <div class='main_xiaoxi_state' >
                           <div class='main_xiaoxi_state_dian'></div>
                           <div class='main_xiaoxi_state_boolean'>已读</div>
                            </div>";
            }
            $str .= "  <div class='main_xiaoxi_time' >$time</div>
                            <a href='?action=".$item['action']."&proposalID=".$item['proposalId']."&taskid=".$item['id']."' class='main_xiaoxi_a ' id='main_02'><div class='main_xiaoxi_chakan' id='main_02'>查看</div></a></div>";
        }
    }

    $str .= "
             </div>
             <div style='width: 4%;float: left;height: 279px;margin-top: 7px;'></div>
             <div class='solide_box' style='width: 230px;height: 471px;float: left;margin-top: 10px;'>";

            //type :提案类型 1：经济类 2：文教体卫 3：政法统战政协
            $typeSize = array();
            $sql = "select sum(type=1) as jingjiSize,sum(type=2) as wenjiaoSize,sum(type=3) as zhengfaSize,count(*) as allSize from proposal";
            $result = $GLOBALS['DB']->query($sql);
            while($res=$result->fetch()) {
                $typeSize = $res;
            }

            $str.="<div style='width: 100%;height: 140px;position: relative;background-color: #f4faff'>
                        <div style='display: inline-block;background: url(images/main/1.png) no-repeat 25px;position: relative;top: 50%;transform: translateY(-50%);width: 100%;height: 100px;'>
                            <div style='position: relative;left: 45%;display: inline-block'>
                                <span style='line-height: 100px;font-size: 34px;text-align: center;color: #666666'><b>".$typeSize['zhengfaSize']."</b></span>
                                <span style='color: #666666;font-size: 20px'>{件}</span>
                            </div>
                        </div>
                        <div style='height: 25px;position: absolute;right: 20px;bottom: 20px;'>
                            <span style='line-height: 22px;font-size: 18px;text-align: center;color: #666666;'><b>".((int)(($typeSize['zhengfaSize']/$typeSize['allSize'])*100))."</b></span>
                            <span style='font-size: 18px;color: #666666'>%</span>
                        </div>
                   </div>";
            $str.="<div style='width: 100%;height: 140px;position: relative;margin-top: 25px;background-color: #fffbf3'>
                        <div style='display: inline-block;background: url(images/main/3.png) no-repeat 25px;position: relative;top: 50%;transform: translateY(-50%);width: 100%;height: 100px;'>
                            <div style='position: relative;left: 45%;display: inline-block'>
                                <span style='line-height: 100px;font-size: 34px;text-align: center;color: #666666'><b>".$typeSize['jingjiSize']."</b></span>
                                <span style='color: #666666;font-size: 20px'>{件}</span>
                            </div>
                        </div>
                        <div style='height: 25px;position: absolute;right: 20px;bottom: 20px;'>
                            <span style='line-height: 22px;font-size: 18px;text-align: center;color: #666666;'><b>".((int)(($typeSize['jingjiSize']/$typeSize['allSize'])*100))."</b></span>
                            <span style='font-size: 18px;color: #666666'>%</span>
                        </div>
                   </div>";
            $str.="<div style='width: 100%;height: 140px;position: relative;margin-top: 25px;background-color: #f9f8ff'>
                        <div style='display: inline-block;background: url(images/main/2.png) no-repeat 25px;position: relative;top: 50%;transform: translateY(-50%);width: 100%;height: 100px;'>
                            <div style='position: relative;left: 45%;display: inline-block'>
                                <span style='line-height: 100px;font-size: 34px;text-align: center;color: #666666'><b>".$typeSize['wenjiaoSize']."</b></span>
                                <span style='color: #666666;font-size: 20px'>{件}</span>
                            </div>
                        </div>
                        <div style='height: 25px;position: absolute;right: 20px;bottom: 20px;'>
                            <span style='line-height: 22px;font-size: 18px;text-align: center;color: #666666;'><b>".((int)(($typeSize['wenjiaoSize']/$typeSize['allSize'])*100))."</b></span>
                            <span style='font-size: 18px;color: #666666'>%</span>
                        </div>
                   </div>";

    $str .= "
            </div>
            </div>";
    return $str;
}

function _zhengxie_outputMain_dialog()
{
    if (!empty($_REQUEST['announcementID'])){
        $announcementID = $_REQUEST['announcementID'];
        $announcementInfo = getTaskToId($announcementID);
        $userInfo = getUserInfo($announcementInfo['userid']);
        $zhiwei = getUserGroupToId($userInfo['role']);

        if (empty($announcementInfo['checkid'])){
            $checkid=$_SESSION['USERID'];
        }else{
            $checkids = explode(',',$announcementInfo['checkid']);
            $in = in_array($_SESSION['USERID'],$checkids);
            if ($in){
                $checkid=$announcementInfo['checkid'];
            }else{
                $checkid=$announcementInfo['checkid'].','.$_SESSION['USERID'];
            }
        }

            //通知框
        $sql = "update task set lookNum=lookNum+1,isLook=1,checkid='".$checkid."' where id=".$_REQUEST['announcementID'];
        $GLOBALS['DB']->query($sql);

        $str = "<script>$('.main_bottom_dialog').css('display','block');</script>
           <div class='dialog_tongzhi' style='width:680px;height:480px;background-color: white;position: relative;top: 18%;left: 36%;border-radius: 8px;display:block'>
               <div style='height: 82px;background-color: #3e8ffe;border-top-left-radius: 8px;border-top-right-radius: 8px;color: white;font-size: 17px;line-height: 82px;text-align: center'>"
                    .$announcementInfo['title']."
                    <div class='main_dialog_cuohao' style='background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
               </div>
           
               <div style='width: 100%;height: 320px;padding-top: 32px;padding-left: 30px'>
                    <div> 
                        <div style='background-image: url(images/main/touxiang.png);width: 64px;height: 64px;background-repeat: no-repeat;background-position: center;background-size: 64px;float: left'></div>
                        <div style='height: 60px;line-height: 60px;float: left;color: #333;font-size: 20px;padding-left: 16px'>".$zhiwei['role']."-".$userInfo['realname']."</div>
                        <div style='clear: both'></div>
                    </div>
                    <div style='margin-top: 32px'> 
                        <div style='width: 69px;height: 68px;color: #ffaa04;font-size: 16px;text-align: center;display: inline;float: left'>【公告】:</div>
                        <div style='height: 100px;float: left;width: 460px;color: #333;margin-left: 13px;font-size: 16px'>".$announcementInfo['taskcontent']."</div>
                        <div style='clear: both'></div>
                        <div> 
                            <div style='margin-top: 15px'>  
                                <div style='width: 64px;height: 64px;color: #333;font-size: 14px;text-align: center;display: inline;float: left'>附件 :</div>
                                <div style='background-image: url(images/main/word.png);background-repeat: no-repeat;background-size: 20px; margin-left: 16px;background-position: center;width: 20px;height: 20px;float: left'></div>
                                <a href='?action=main&filelist=".$announcementInfo['fileid']."'><div class='main_dialog_dowload' style='width: 100px;float: left;color: #8cbdff;height: 20px;line-height: 20px;font-size: 16px;margin-left: 5px'>查看/下载</div></a>
                            </div>
                        </div>
                    </div>
               </div>
           
               <div style='width: 100%;height: 78px;background-color: #f0f6ff;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;display: flex;align-items: center'> 
                   <div class='main_bottom_dialog_zhidao' style='width: 210px;height: 48px;background-color: #3e8ffe;border-radius:10px;text-align: center;line-height: 48px;color: white;font-size: 16px;margin: 0px auto;'>
                        知道了
                   </div>
                   <script>
                    $('.main_bottom_dialog_zhidao').click(function() {
                        $(\".main_bottom_dialog\").css(\"display\",\"none\");
                    });
                   </script>
               </div>
           </div>";
        return $str;
    }

    if (!empty($_REQUEST['modifyPassword'])){
        $str = "<script>$('.main_bottom_dialog').css('display','block');</script>
           <div class='dialog_mima' style='width:680px;height:420px;background-color: white;position: relative;top: 18%;left: 36%;border-radius: 8px;display: block'>
               <div style='height: 75px;background-color: #3e8ffe;border-top-left-radius: 8px;border-top-right-radius: 8px;color: white;font-size: 17px;line-height: 75px;text-align: center'>
                   修改密码
                   <div class='main_dialog_cuohao' style='background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 75px;float: right'></div>
               </div>
           
               <div style='width: 100%;height: 280px;padding-top: 56px;'> 
                       <div style='height: 50px;width:470px;margin: 0px auto'>
                           <div style='float: left;height:50px;line-height: 50px;color: #444;font-size: 16px;width: 90px'>原密码:</div>
                           <input class='oldpwd' type='text' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 344px;height: 50px;border: 1px solid #f5faff;background-color: #fafdff;float: left;margin-left: 25px' >
                       </div>
                
                       <div style='height: 50px;width:470px;margin: 0px auto;margin-top: 30px'>
                           <div style='float: left;height:50px;line-height: 50px;color: #444;font-size: 16px;width: 90px'>新密码:</div>
                           <input class='newpwd_1' type='text' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 344px;height: 50px;border: 1px solid #f5faff;background-color: #fafdff;float: left;margin-left: 25px' >
                       </div>
                       
                       <div style='height: 50px;width:470px;margin: 0px auto;margin-top: 30px'>
                           <div style='float: left;height:50px;line-height: 50px;color: #444;font-size: 16px;width: 90px'>确认新密码:</div>
                           <input class='newpwd_2' type='text' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 344px;height: 50px;border: 1px solid #f5faff;background-color: #fafdff;float: left;margin-left: 25px' >
                       </div>
                       <div class='mima_error_dialog' style='visibility:hidden;padding-left: 10px;padding-right: 10px;color: #f43f21;width: 250px;position: relative;left: 50%;top: 12px;transform: translateX(-50%);height: 50px;background-color: #3333;border-radius: 2px;line-height: 50px;text-align: center'></div>
               </div>
           
               <div style='width: 100%;height: 78px;background-color: #f0f6ff;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;display: flex;align-items: center'> 
                   <div id='".$GLOBALS['USERINFO']['id']."' class='main_bottom_dialog_mima' style='width: 210px;height: 48px;background-color: #3e8ffe;border-radius:10px;text-align: center;line-height: 48px;color: white;font-size: 16px;margin: 0px auto;' onclick='changePwd()'>
                        登录
                   </div>
                   <style>.main_bottom_dialog_mima:hover{cursor: pointer}</style>
               </div>
           </div>";
        return $str;
    }
    /*<input class='input_party'  type='text' value='".$GLOBALS['USERINFO']['party']."' style='color:#444;text-indent: 12px;border-radius: 4px;font-size: 16px;width: 270px;height: 40px;border: 1px solid #f5faff;background-color: #fafdff;float: left;line-height: 40px' >*/
    if (!empty($_REQUEST['userinfo'])){
        $str = "<script>$('.main_bottom_dialog').css('display','block');</script>
           <div class='dialog_geren' style='width:680px;height:480px;background-color: white;position: relative;top: 18%;left: 36%;border-radius: 8px;display: block'>
               <div style='height: 82px;background-color: #3e8ffe;border-top-left-radius: 8px;border-top-right-radius: 8px;color: white;font-size: 17px;line-height: 82px;text-align: center'>
                    编辑个人资料
                    <div class='main_dialog_cuohao' style='background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
               </div>
           
           <div style='width: 100%;height: 310px;padding-top: 20px;padding-left: 30px'> 
            <div style='width: 100%;height:190px;float: left'>
                 <div style='width:419px;height: 180px;display: inline-block;float: left'>
                    <div style='width: 419px;'>
                        <div style='height: 50px;width:400px;margin: 0px auto'>
                            <div style='float: left;height:40px;line-height: 40px;color: #444;font-size: 16px;width: 90px'>姓名:</div>
                            <input class='input_name'  value='".$GLOBALS['USERINFO']['realname']."' type='text' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 270px;height: 40px;border: 1px solid #f5faff;background-color: #fafdff;float: left;line-height: 40px' >
                        </div>
                    </div>
                    <div style='width: 419px;margin-top: 15px'>
                        <div style='height: 50px;width:400px;margin: 0px auto'>
                            <div style='float: left;height:40px;line-height: 40px;color: #444;font-size: 16px;width: 90px'>年龄:</div>
                            <input class='input_age' type='text' value='".$GLOBALS['USERINFO']['age']."' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 270px;height: 40px;border: 1px solid #f5faff;background-color: #fafdff;float: left;line-height: 40px' >
                        </div>
                    </div>
                    <div style='width: 419px;margin-top: 15px'>
                        <div style='height: 50px;width:400px;margin: 0px auto'>
                            <div style='float: left;height:40px;line-height: 40px;color: #444;font-size: 16px;width: 90px'>党派团体:</div>
                            <span class='select' style='width: 270px;background-image: url(images/wode/sanjiao.png);background-repeat: no-repeat;background-position: 90%;;font-size: 16px;color: #666;text-indent: 15px;border: 1px solid #e5e5e5;float: left;border-radius: 4px;height:40px;line-height:40px;position: relative;top: 50%;transform: translateY(-50%)'>".$GLOBALS['USERINFO']['party']."</span>
                            <ul class='sub1'>";
                    $partylist = getPartyList();
                    foreach ($partylist as $value){
                        $str.="<li>".$value['partyname']."</li>";
                    }
                    $str.="</ul>
                        </div>
                    </div>
                 </div>";


        $str.="
                    <style>
                        .select:hover{cursor:pointer;}
                        .sub1{list-style-type:none;height: 122px;overflow: auto}
                        .sub1{font-size: 16px;position: absolute;top: 278px;left:130px;color:#e5e5e5;width:270px;background-color: #ffffff;border:1px solid #e5e5e5;display: none}
                        .sub1 li{color: #999;height:40px;text-align: center;line-height:40px;cursor:pointer;border-bottom:1px solid #e5e5e5;}
                        .sub1 li.hover{background:#fafdff;}
                    </style>
                    <script>
                        
                        $('.select').click(function(event) {
                            $('.sub1').css('display') == 'none' ? $('.sub1').css('display','block') : $('.sub1').css('display','none');
                        });
                        
                        $('.sub1 li').each(function() {
                            
                            $(this).mouseover(function() {
                                $(this).css('background-color','#fafdff');
                            });
                            
                            $(this).mouseout(function() {
                                $(this).css('background-color','#fff');
                            });
                            
                            $(this).click(function() {
                              var text = $(this).text();
                              $('.select').html(text);
                              $('.sub1').css('display','none');
                            });
                        });
                    </script>
                    <div style='padding-left: 150px;height: 1%;float: left'>
                        <div type='text' style='color: #c9c9c9;font-size: 20px;width: 100%;position: relative;top: -180px;left: 290px;height: 90px;'>
                            <div class='avatar-list' style='width: 91%;'>
                                <img class='avatar-grid'>
                                    <input class='shangchuan' type='file' accept='image/*'>
                                </img>
                                <div style='clear:both'></div>
                            </div>
                        </div>
                    </div>
                    <style>
                        .avatar-grid{
                            height: 130px;
                            width: 130px;
                            color: #f2f2f2;
                            float: left;
                            margin-left: 1px;
                            margin-top: 1px;
                            margin-bottom: 1px;
                            font-size: 30px;
                            line-height: 130px;
                            text-align: center;
                            cursor: pointer;
                            border: 1px solid #f2f2f2;
                            background-image: url(images/main/shangchuan1.png);
                            background-repeat: no-repeat;
                            background-position: center;
                        }
                        
                        .shangchuan{
                            position: relative;
                            top:-130px;
                            cursor: pointer;
                            opacity: 0;
                            height: 130px;
                            width: 130px;
                        }
                    </style>
                    <div style='clear: both'></div>
                    <div style='width: 100%;height:130px;padding-left: 9px;'> 
                        <div style='width: 620px; margin-top: 10px'>
                            <div style='height: 42px;width:620px;margin: 0px auto;'>
                                <div style='float: left;height:42px;line-height: 42px;color: #444;font-size: 16px;width: 90px;'>工作单位:</div>
                                <input class='input_work' type='text' value='".$GLOBALS['USERINFO']['work']."' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 495px;height: 42px;border: 1px solid #f5faff;background-color: #fafdff;float: left;' >
                            </div>
                        </div>
                        <div style='width: 620px; margin-top: 20px'>
                            <div style='height: 42px;width:620px;margin: 0px auto;'>
                                <div style='float: left;height:42px;line-height: 42px;color: #444;font-size: 16px;width: 90px'>联系方式:</div>
                                <input class='input_cotactway' type='text' value='".$GLOBALS['USERINFO']['phone']."' style='text-indent: 12px;border-radius: 4px;font-size: 16px;width: 495px;height: 42px;border: 1px solid #f5faff;background-color: #fafdff;float: left;' >
                            </div>
                        </div>
                    </div>
           </div>
         
           </div>
               <div style='width: 100%;height: 78px;background-color: #f0f6ff;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;display: flex;align-items: center'> 
                   <div id='".$GLOBALS['USERINFO']['id']."' class='main_bottom_dialog_queding' style='width: 210px;height: 48px;background-color: #3e8ffe;border-radius:10px;text-align: center;line-height: 48px;color: white;font-size: 16px; margin: 0px auto;' onclick='changeProfile()'>
                        确定
                   </div>
                   <script>
                    $('.main_bottom_dialog_queding').click(function() {
                        var xingming = $('.input_name').val();
                        var nianling = $('.input_age').val();
                        var dangpai = $('.select').text();
                        var gongzuo = $('.input_work').val();
                        var phone = $('.input_cotactway').val();
                        $.getJSON('api.php?action=api_modifyUserInfo',
                        {'xingming':xingming,
                        'nianling':nianling,
                        'dangpai':dangpai,
                        'gongzuo':gongzuo,
                        'phone':phone},function(res) {
                           if (res.code == 0){
                               window.location.href='?action=main&success=1';
                           }else {
                               alert(res.msg);
                           }
                        });
                    });
                   </script>
               </div>
           </div>";
        return $str;
    }

    if (isset($_REQUEST['filelist'])) {
        //下载
        $str = "<script>$('.main_bottom_dialog').css('display','block');</script>";
        $str .= "<div style='position: absolute;top: 25%;margin-left: 210px;left: 45%;transform: translateX(-50%); width: 686px;height: 480px;'>
                    <div style='background-color: #3e8ffe;background-size: 100% 100%;border-top-left-radius: 8px;border-top-right-radius: 8px;height: 82px;width: 100%;line-height: 82px;text-align: center;color: white;font-size: 20px;'>
                        <span style='position: absolute;left: 50%;transform: translateX(-50%)'>文件目录</span>
                        <div class='main_dialog_cuohao' onclick='dissmissdialog()' style='position: relative;top: -20px;background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
                    </div>
                    <div style='background-color: white;height: 398px;width: 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;'>
                        <div class='solide_box' style='width: 600px;height: 398px;background-color: white;overflow: auto;padding-top: 20px;margin: 0px auto;'>
                            <span style='color: #999999'>内容下载</span>";

        if ($_REQUEST['filelist'] != 0){
            $data = array();
            $sql = "select * from enclosure where id in(".$_REQUEST['filelist'].")";
            error_log($sql);
            $result = $GLOBALS['DB']->query($sql);
            while($res=$result->fetch()) {
                $data[] = $res;
            }

            foreach ($data as $value){
                $str.="<div style='width: 100%;height: 50px;background: url(images/daifankui/wenjianjia.png) no-repeat 10px'>
                <div style='overflow: hidden;display: inline-block;margin-left: 50px;max-width: 350px;height: 50px;line-height: 50px'>".$value['enclosurename']."</div>
                <a href='".$value['enclosureurl']."' style='float: right;position: relative;top: 50%;transform: translateY(-50%)'><img style='width: 32px;height: 32px;' src='images/daifankui/xiazai.png'></a>
                <div style='color: #999999;max-width: 130px;height: 50px;line-height: 50px;margin-right: 20px;float: right'>".$value['enclosuretime']."</div>
             </div>";
            }
        }
        $str.="</div>
                    </div>
                </div>";
        return $str;
    }

    if (!empty($_REQUEST['success'])){
        $str = "<script>$('.main_bottom_dialog').css('display','block');</script>
           <div class='dialog_gerenchenggong' style='width:680px;height:480px;background-color: white;position: relative;top: 18%;left: 36%;border-radius: 8px;display: block'>
               <div style='height: 202px;background-image: url(images/main/diban2.png);width: 100%;background-size: 680px 202px';></div>
               <div style='width: 100%;height: 200px;'> 
                   <div style='height: 93px;width: 260px;margin: 0 auto;position: relative;top: 50%;transform:translateY(-50%);'>
                        <div style='color: #87ba4d;font-size: 26px;text-align: center'>个人资料修改成功</div>
                        <div style='color: #87ba4d;font-size: 14px;margin-top: 36px;text-align: center'>确定您个人资料的完整性,确保更好的工作</div>
                  </div>
               </div>
               <div style='width: 100%;height: 78px;background-color: #f0f6ff;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;display: flex;align-items: center'> 
                   <div class='main_bottom_dialog_wanchengle' style='width: 210px;height: 48px;background-color: #3e8ffe;border-radius:10px;text-align: center;line-height: 48px;color: white;font-size: 16px; margin: 0px auto;'>
                        返回
                   </div>
                   <script>
                    $('.main_bottom_dialog_wanchengle').click(function() {
                        $('.main_bottom_dialog').css('display','none');
                    });
                   </script>
               </div>
           </div>";
        return $str;
    }

}


